﻿<%@ Page Language="C#" MasterPageFile="~/admin/admin.master" AutoEventWireup="true" CodeFile="editor.aspx.cs" Inherits="admin_systemproduct_editor" Title="无标题页" %>

<asp:Content ID="Content1" ContentPlaceHolderID="headPlaceHolder" runat="Server">
    <link href="../uploadify-v3.1/uploadify.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="contentPlaceHolder" runat="Server">
    <form id="form1" runat="server">
    <div style="height: 40px; line-height: 40px; padding: 0 10px;">
        <div class="pull-left" style="height: 40px; line-height: 40px;">
            <h2 id="bigTitle">
                系统产品
            </h2>
        </div>
    </div>
    <hr />
    <div class="row" style="margin-top: 20px;">
        <div class="span1">
            标题：</div>
        <div class="span11">
            <asp:TextBox ID="TxtId" runat="server" Style="display: none"></asp:TextBox>
            <asp:TextBox ID="TxtTitle" runat="server" Width="700px"></asp:TextBox>
        </div>
    </div>
    <div class="row" style="margin-top: 20px;">
        <div class="span1">
            应用领域：</div>
        <div class="span11">
            <asp:TextBox ID="TxtField" runat="server" Width="700px"></asp:TextBox>
        </div>
    </div>
    <div class="row" style="margin-top: 20px;">
        <div class="span1">
            描述：
        </div>
        <div class="span11">
            <asp:TextBox ID="TxtDes" runat="server" TextMode="MultiLine" Height="90px" Width="700px"></asp:TextBox>
        </div>
    </div>
    <div class="row" style="margin-top: 20px;">
        <div class="span1">
            图片：
        </div>
        <div class="span11">
            <input type="file" name="file_upload" id="file_upload" />
            <img id="mImg" runat="server" src="" />
            <asp:TextBox ID="srcHidden" runat="server" Style="visibility: hidden;"></asp:TextBox>
            <asp:TextBox ID="htmlName" runat="server" Style="visibility: hidden"></asp:TextBox>
        </div>
    </div>
    <div class="row" style="margin-top: 20px;">
        <div class="span1">
            详细介绍：
        </div>
        <div class="span11">
            <textarea id="content1" cols="100" rows="8" style="width: 700px; height: 200px; visibility: hidden;"
                runat="server"></textarea>
        </div>
    </div>
    <div class="row" style="margin-top: 20px;">
        <div class="span2 offset3">
            <%--<button id="queryBtn" class="btn  btn-primary  btn-large" runat="server" onclick="{ if(CheckClick()=='false')  return; }"
                onserverclick="Button1_Click">
                <i class=" icon-ok icon-white"></i>保存</button>--%>
            <input type="submit" id="Button1" class="btn  btn-primary  btn-large" runat="server" onserverclick="Button1_Click" value="保存" />
        </div>
        <div class="span2">
            <a href="admin.aspx" class="btn btn-info  btn-large"><i class="icon-th-list icon-white">
            </i>返回列表</a>
        </div>
    </div>
    </form>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="javascriptPlaceHolder" runat="Server">
    <script src="../uploadify-v3.1/jquery.uploadify-3.1.min.js" type="text/javascript"></script>

    <script charset="utf-8" src="../kindeditor-4.1/kindeditor.js"></script>

    <script charset="utf-8" src="../kindeditor-4.1/lang/zh_CN.js"></script>

    <script>
     var editor1
		KindEditor.ready(function(K) {
			 editor1 = K.create('#<%=content1.ClientID %>', {
				uploadJson : '../kindeditor-4.1/asp.net/upload_json.ashx',
				fileManagerJson : '../kindeditor-4.1/asp.net/file_manager_json.ashx',
				allowFileManager : true
			});
		});

        $(function() {
                 $('#file_upload').uploadify({
                    'swf'      : '../uploadify-v3.1/uploadify.swf',
                    'uploader' : '../ImageUpload.ashx',
                    'onUploadSuccess' : function(file, data, response) {                       
                        var json = $.parseJSON(data);
                        document.getElementById('<%=mImg.ClientID %>').src=json.url;
                        document.getElementById('<%=srcHidden.ClientID %>').value=json.url;
                    }
                });
                
                 $("#bigTitle").html('系统产品');
        });
        
        function CheckClick()
	    {
	    alert(editor1.html());
	    return true;
		   var title=document.getElementById('<%=TxtTitle.ClientID %>').value;
		   var field=document.getElementById('<%=TxtField.ClientID %>').value;
		   var des=document.getElementById('<%=TxtDes.ClientID %>').value;
		   var src=document.getElementById('<%=srcHidden.ClientID %>').value;
		   var html=editor1.html();
		   var id=document.getElementById('<%=TxtId.ClientID %>').value;
		   
		   if(id==null||id=="")
		   {
		     if(src==null||src=="")
		     {
		        alert("请上传一个图片");
		        return "false";
		     }
		   }
		   
		   if(title==null||title=="")
		   {
		        alert("请填写标题");
		        return "false";
		   }
		   
		   if(field==null||field=="")
		   {
		        alert("请填写应用领域");
		        return "false";
		   }
		   
		   if(des==null||des=="")
		   {
		        alert("请填写描述");
		        return "false";
		   }
		   
		   if(html==null||html=="")
		   {
		        alert("请填写详细介绍");
		        return "false";
		   }
		   
		   return "true";
	    }
    </script>

</asp:Content>